"""
带参数的get请求
1）直接对含有参数的url发起请求：
    url = 'http://www.baidu.com/s?wd=python'
2)通过params携带参数字典
"""

import requests

# 1)直接对含有参数的url发起请求
url = 'http://www.baidu.com/s?wd=python'
h = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36'
}
response = requests.get(url , headers=h)
print(response.content.decode())
print('-'*20)
#2)通过params携带参数字典
url = 'http://www.baidu.com/s?'
# 将参数构造字典
p = {
    'wd': 'python'
}
response = requests.get(url, headers=h, params=p)
print(response.content.decode())




















